/*
 * Copyright (c) 2019 Author: Fancyears Milos Malvis @1243093366@qq.com
 * ALL COPYRIGHT REVERSED.
 */

package com.fancyears.controller;

import com.fancyears.service.i.encryption.RSAService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.Map;

/**
 * @Author: Fancyears Milos Malvis
 * @Date: Created in  2019/6/27 11:47
 * @Modified By:
 */
@RestController
@RequestMapping("rsa")
public class RSAController {
    @Autowired
    RSAService rsaService;

    @RequestMapping("getSession")
    public Map<String, String> getSession(HttpSession session) throws IOException, NoSuchAlgorithmException {
        return rsaService.getSession(session);
    }

    @RequestMapping("loginByEncrypt")
    public Map<String, Object> loginByEncrypt(@RequestBody Map<String, String> params,HttpSession session){
       return  rsaService.loginByEncrypt(params,session);
    }

    @RequestMapping("updatePassword")
    public Map<String, Object> updatePassword(@RequestBody Map<String, String> params,HttpSession session){
        return  rsaService.updatePassword(params,session);
    }
}
